package com.allwayz.controller;

import com.allwayz.service.PaymentHystrixService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author allwayz
 */
@RestController
@RequestMapping("order")
@Slf4j
public class OrderHystrixController {
    @Resource
    private PaymentHystrixService paymentHystrixService;

    @GetMapping("/payment/hystrix/ok/{id}")
    public String paymentHystrixOk(@PathVariable Integer id){
        return paymentHystrixService.paymentInfoOk(id);
    }

    @GetMapping("/payment/hystrix/timeout/{id}")
    public String paymentHystrixTimeout(@PathVariable Integer id){
        return paymentHystrixService.paymentInfoTimeOut(id);
    }

}
